Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: move back to nullable forwarding. #6733

Merged
merged 4 commits into from
Jul 2, 2024

Conversation

DimitrisJim
Copy link
Contributor

@DimitrisJim DimitrisJim commented Jul 1, 2024

Description

validation needed tweaking which resulted in not as clean of a pr as I'd wanted

closes: #XXXX


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against the correct branch (see CONTRIBUTING.md).
  • Linked to GitHub issue with discussion and accepted design, OR link to spec that describes this work.
  • Code follows the module structure standards and Go style guide.
  • Wrote unit and integration tests.
  • Updated relevant documentation (docs/).
  • Added relevant godoc comments.
  • Provide a conventional commit message to follow the repository standards.
  • Include a descriptive changelog entry when appropriate. This may be left to the discretion of the PR reviewers. (e.g. chores should be omitted from changelog)
  • Re-reviewed Files changed in the GitHub PR explorer.
  • Review SonarCloud Report in the comment section below once CI passes.

Comment on lines 39 to 42
// Initialize empty pointer with empty forwarding information
if msg.Forwarding == nil {
msg.Forwarding = types.NewForwarding(false)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really do not like this, though

Copy link
Contributor

@bznein bznein Jul 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this needed for?>

If it's only for the check below (and for the call to sednTransfer, maybe it can be slightly cleaner like this?

var hops []types.Hops
if msg.Forwarding  != nil {
      hops = msg.Forwarding.Hops 
      if msg.Forwarding.Unwind {
         ....
       } 
}

	sequence, err := k.sendTransfer(
		ctx, msg.SourcePort, msg.SourceChannel, coins, sender, msg.Receiver, msg.TimeoutHeight, msg.TimeoutTimestamp,
		msg.Memo, hops)

Still not super clean, but maybe marginally better?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we'd also need to move assignment to hops after that unwind call considering it could modify it but yea, think this couild be an alt if people have preferences.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be fine with:

if msg.Forwarding != nil && msg.Forwarding.Unwind

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mainly did this because we forward hops after when calling into sendTransfer and didn't want two nil checks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe also pretty dirty, but could do something like

func (f *Forwarding) Unwind() {
  if f == nil {
    return false
  }
  return f.Unwind 
}

Perfectly happy with the inline check colin suggested though 👍

Copy link
Contributor Author

@DimitrisJim DimitrisJim Jul 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, I definitely prefer this. Will probably do for Hops too.

lol, forgot proto generates these for us 🤦

// forwarding information present in the message. If forwarding information is missing
// or unwinding isn't performed, we do normal validation, else, we assert that both
// fields must be empty.
func (msg MsgTransfer) validateIdentifiers() error {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this made more sense to me instead of having it partially in one func and partially in another.

@DimitrisJim DimitrisJim added the priority PRs that need prompt reviews label Jul 1, 2024
Copy link
Contributor

@bznein bznein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking care of this!

Comment on lines 39 to 42
// Initialize empty pointer with empty forwarding information
if msg.Forwarding == nil {
msg.Forwarding = types.NewForwarding(false)
}
Copy link
Contributor

@bznein bznein Jul 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this needed for?>

If it's only for the check below (and for the call to sednTransfer, maybe it can be slightly cleaner like this?

var hops []types.Hops
if msg.Forwarding  != nil {
      hops = msg.Forwarding.Hops 
      if msg.Forwarding.Unwind {
         ....
       } 
}

	sequence, err := k.sendTransfer(
		ctx, msg.SourcePort, msg.SourceChannel, coins, sender, msg.Receiver, msg.TimeoutHeight, msg.TimeoutTimestamp,
		msg.Memo, hops)

Still not super clean, but maybe marginally better?

Copy link
Contributor

@crodriguezvega crodriguezvega left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @DimitrisJim. I triggered a compatibility test run with this branch so that we can have fresh results tomorrow morning.

@DimitrisJim
Copy link
Contributor Author

Seems we hit a rate limit but, on docker this time? 😆 https://github.com/cosmos/ibc-go/actions/runs/9750596978/job/26910547489#step:4:30

@DimitrisJim
Copy link
Contributor Author

triggered again https://github.com/cosmos/ibc-go/actions/runs/9755361718/job/26923850921 seems we don't have an image for 7.6.0 which causes most failures. Flakes exist for ica ones, transfer ones should hopefully pass through considering they did in the run you triggered yesterday.

@crodriguezvega
Copy link
Contributor

https://github.com/cosmos/ibc-go/actions/runs/9755361718/job/26923850921

Ay, I see that the release workflow failed for v7.6.0 when the release was tagged, so that would explain why there is no docker image. Not sure what the error means though... I have triggered now a docker build action for v7.6.0

Copy link
Contributor

@chatton chatton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I think the additional check on nil isn't ideal but it's not the end of the world, it's still clear what the requirements are.

Comment on lines 39 to 42
// Initialize empty pointer with empty forwarding information
if msg.Forwarding == nil {
msg.Forwarding = types.NewForwarding(false)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe also pretty dirty, but could do something like

func (f *Forwarding) Unwind() {
  if f == nil {
    return false
  }
  return f.Unwind 
}

Perfectly happy with the inline check colin suggested though 👍

Copy link

sonarcloud bot commented Jul 2, 2024

@DimitrisJim DimitrisJim added this pull request to the merge queue Jul 2, 2024
Merged via the queue into main with commit 0cfa0e9 Jul 2, 2024
132 of 134 checks passed
@DimitrisJim DimitrisJim deleted the jim/make-forwarding-pointer branch July 2, 2024 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority PRs that need prompt reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants